<template>
  <div class="main_box" style="padding:10px;">
    <div class="detail_wrap">
      <div class="tit">
        <h2>基础信息</h2>
        <el-button type="success" plain size="small" icon="fa fa-mail-forward" @click="returnList">返回</el-button>
      </div>
      <div class="con">
        <ul>
          <li>
            <label class="label">用户名：</label>
            <span>{{detailData.userName}}</span>
          </li>
          <li>
            <label class="label">用户昵称：</label>
            <span>{{detailData.nickName}}</span>
          </li>
          <li>
            <label class="label">手机号：</label>
            <span>{{detailData.phone}}</span>
          </li>
          <li>
            <label class="label">所属公司：</label>
            <span>{{detailData.sysDepartName}}</span>
          </li>
<!--          <li>
            <label class="label">所属商户：</label>
            <span>{{detailData.businessName}}</span>
          </li>-->
          <li>
            <label class="label">用户角色：</label>
            <span>{{formatUserRole(detailData.adminRole)}}</span>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import AuthApi from "@/api/system/auth";
export default{
    data(){
        return {
          detailData: [],
          departList: [],
        }
    },
    mounted(){
      this.init();
    },
    methods:{
      init(){
        this.getData();
      },
      getData(){
        AuthApi.getAdmin({adminId:this.$route.query.id})
        .then(res => {
          this.detailData = res.data;
        })
      },
      formatUserRole(cellValue) {
        if (cellValue === 1) {
          return "系统管理员";
        } else if (cellValue === 5) {
          return "社区管理员";
        }  else if (cellValue === 6) {
          return "119管理员";
        } else if (cellValue === 7) {
          return "120管理员";
        } else if (cellValue === 8) {
          return "110管理员";
        }else if (cellValue === 10) {
          return "业务员";
        }
      },
      returnList(){
        this.$store.dispatch('delView', this.$route);
        this.$router.push({path: "/sys/adminManagement"})
      }
    },
}
</script>
<style lang="scss" scoped>
@import "@/assets/css/views/Detail.scss";
</style>
